/*     */ package com.cr.business;
/*     */ 
/*     */ import com.cr.business.domain.CrService;
/*     */ import com.cr.business.service.ICrServiceService;
/*     */ import com.cr.common.annotation.Log;
/*     */ import com.cr.common.core.controller.BaseController;
/*     */ import com.cr.common.core.domain.AjaxResult;
/*     */ import com.cr.common.core.page.TableDataInfo;
/*     */ import com.cr.common.enums.BusinessType;
/*     */ import com.cr.common.utils.poi.ExcelUtil;

import java.util.Date;
/*     */ import java.util.List;
/*     */ import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.BeanUtils;
/*     */ import org.springframework.beans.factory.annotation.Autowired;
/*     */ import org.springframework.stereotype.Controller;
/*     */ import org.springframework.ui.ModelMap;
/*     */ import org.springframework.web.bind.annotation.GetMapping;
/*     */ import org.springframework.web.bind.annotation.PathVariable;
/*     */ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/*     */ import org.springframework.web.bind.annotation.RequestMapping;
/*     */ import org.springframework.web.bind.annotation.ResponseBody;
/*     */ 
/*     */ @Controller
/*     */ @RequestMapping({"/business/service"})
/*     */ public class CrServiceController extends BaseController {
/*  32 */   private String prefix = "business/service";
/*     */   
/*     */   @Autowired
/*     */   private ICrServiceService crServiceService;
/*     */   
/*     */   @RequiresPermissions({"business:service:view"})
/*     */   @GetMapping
/*     */   public String service() {
/*  41 */     return this.prefix + "/service";
/*     */   }
/*     */   
/*     */   @RequiresPermissions({"business:service:list"})
/*     */   @PostMapping({"/list"})
/*     */   @ResponseBody
/*     */   public TableDataInfo list(CrService crService) {
/*  52 */     startPage();
/*  53 */     List<CrService> list = this.crServiceService.selectCrServiceList(crService);
/*  54 */     return getDataTable(list);
/*     */   }
/*     */   
/*     */   @RequiresPermissions({"business:service:export"})
/*     */   @Log(title = "金点子服务", businessType = BusinessType.EXPORT)
/*     */   @PostMapping({"/export"})
/*     */   @ResponseBody
/*     */   public AjaxResult export(CrService crService) {
/*  66 */     List<CrService> list = this.crServiceService.selectCrServiceList(crService);
/*  67 */     ExcelUtil<CrService> util = new ExcelUtil(CrService.class);
/*  68 */     return util.exportExcel(list, "金点子服务数据");
/*     */   }
/*     */   
/*     */   @GetMapping({"/add"})
/*     */   public String add() {
/*  77 */     return this.prefix + "/add";
/*     */   }
/*     */   
/*     */   @RequiresPermissions({"business:service:add"})
/*     */   @Log(title = "金点子服务", businessType = BusinessType.INSERT)
/*     */   @PostMapping({"/add"})
/*     */   @ResponseBody
/*     */   public AjaxResult addSave(@RequestBody CrService crService) {
                 crService.setCreateBy(crService.getUserId().toString());
/* 47 */         crService.setCreateTime(new Date());
                 crService.setServiceStatus(0);
                 crService.setQuestionTime(new Date());
/*  89 */     return toAjax(this.crServiceService.insertCrService(crService));
/*     */   }
/*     */   
/*     */   @GetMapping({"/edit/{serviceId}"})
/*     */   public String edit(@PathVariable("serviceId") Long serviceId, ModelMap mmap) {
/*  98 */     CrService crService = this.crServiceService.selectCrServiceByServiceId(serviceId);
/*  99 */     mmap.put("crService", crService);
/* 100 */     return this.prefix + "/edit";
/*     */   }
/*     */   
/*     */   @RequiresPermissions({"business:service:edit"})
/*     */   @Log(title = "金点子服务", businessType = BusinessType.UPDATE)
/*     */   @PostMapping({"/edit"})
/*     */   @ResponseBody
/*     */   public AjaxResult editSave(CrService crService) {
/* 112 */     return toAjax(this.crServiceService.updateCrService(crService));
/*     */   }
/*     */   
/*     */   @RequiresPermissions({"business:service:remove"})
/*     */   @Log(title = "金点子服务", businessType = BusinessType.DELETE)
/*     */   @PostMapping({"/remove"})
/*     */   @ResponseBody
/*     */   public AjaxResult remove(String ids) {
/* 124 */     return toAjax(this.crServiceService.deleteCrServiceByServiceIds(ids));
/*     */   }
/*     */ }


/* Location:              D:\tmp\creditorRights-admin\BOOT-INF\classes\com.zip!\com\cr\business\CrServiceController.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */